//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   Moment_to_Discrete.i.hh
 * \author Jeremy Roberts
 * \date   Sep 6, 2011
 * \brief  Moment_to_Discrete inline member definitions.
 * \note   Copyright (C) 2011 Jeremy Roberts.
 */
//---------------------------------------------------------------------------//
// $Rev:: 125                                           $:Rev of last commit
// $Author:: j.alyn.roberts@gmail.com                   $:Author of last commit
// $Date:: 2011-09-01 20:41:14 -0400 (Thu, 01 Sep 2011) $:Date of last commit
//---------------------------------------------------------------------------//

#ifndef MOMENT_TO_DISCRETE_I_HH_
#define MOMENT_TO_DISCRETE_I_HH_

namespace slabtran
{

//-----------------------------------------------------------------------------
// Operator(cardinal_angle_index, cardinal_moment_index)
template <class D>
inline const double& Moment_to_Discrete<D>::
operator()(const int angle, const int moment) const
{
  Require(angle >= 0);
  Require(angle < d_number_angles);
  Require (moment >= 0);
  Require(moment < d_number_moments);
  return d_M[angle][moment];
}

//-----------------------------------------------------------------------------
// Operator(cardinal_angle_index, legendre_degree, legendre_order)
template <class D>
inline const double& Moment_to_Discrete<D>::
operator()(const int angle, const int l, const int m) const
{
  // Moment cardinal index
  int index = Moments<D>::index(l, m);
  return (*this)(angle, index);
}

//-----------------------------------------------------------------------------
// Operator(octant_index, angle_in_octant, legendre_degree, legendre_order)
template <class D>
inline const double& Moment_to_Discrete<D>::
operator()(const int o, const int n,
           const int l, const int m) const
{
  // Angle cardinal index
  int angle = d_angularmesh->index(o, n);
  // Moment cardinal index
  int moment = Moments<D>::index(l, m);
  return (*this)(angle, moment);
}

} // end namespace slabtran

#endif /* MOMENT_TO_DISCRETE_I_HH_ */
